import request from '@/utils/request'

const createModule = (params) => {
  return request.post('/api/v2/expo-module/create/child', params, {
    headers: {'Content-Type': 'application/json'}
  })
}

const editModule = (level, params) => {
  return request.patch(`/api/v2/expo-module/edit/${level}`, params, {
    headers: {'Content-Type': 'application/x-www-form-urlencoded'}
  })
}

const deleteModule = (level,uid) => {
  return request.delete(`/api/v2/expo-module/delete/${level}/${uid}`)
}

const swapModule = (level,tuid, suid) => {
  return request.put(`/api/v2/expo-module/swap/${level}/${tuid}/${suid}`)
}

const getCreateImage = () => {
  return request.get('/api/v1/expo-module/get-create-image')
}

export default {
  createModule,
  editModule,
  deleteModule,
  swapModule,
  getCreateImage
}
